package com.study_online;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.study_online.domain.ForumChildPost;
import com.study_online.domain.ForumFatherPost;
import com.study_online.domain.User;
import com.study_online.mapper.ForumFatherPostMapper;
import com.study_online.mapper.UserMapper;
import com.study_online.utils.UuidUtil;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import lombok.extern.log4j.Log4j2;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author 张天霸
 */

@Log4j2
@RunWith(SpringRunner.class)
@SpringBootTest
public class MyBatisTest {

    @Autowired
    private ForumFatherPostMapper forumFatherPostMapper;

    private final Logger logger = LoggerFactory.getLogger(MyBatisTest.class);

//    @Test
//    public void test(){
//        User byId = userMapper.findById(9);
//        System.out.println(byId);
//    }

    @Test
    public void test1(){
        Page<ForumFatherPost> page = new Page<>(1,5);
        QueryWrapper<ForumFatherPost> wrapper = new QueryWrapper<>();
        wrapper.like("fatherpost_title","一");
        IPage<ForumFatherPost> iPage = forumFatherPostMapper.selectPage(page,wrapper);
        List<ForumFatherPost> records = iPage.getRecords();
        System.out.println(records);

//        QueryWrapper<ForumChildPost> wrapper1 = new QueryWrapper<>();
//        wrapper.
//        ForumChildPost forumChildPost = new ForumChildPost();
//        forumChildPost.update()
    }

    @Test
    public void test2(){
        String uuid = UuidUtil.getUuid();
        System.out.println(uuid);
    }



}